package com.icode.translate.startup;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.oxm.jaxb.Jaxb2Marshaller;

/**
 * Created with IntelliJ IDEA.
 * User: alexz
 * Date: 14-6-30
 * Time: 下午4:20
 * To change this template use File | Settings | File Templates.
 */
@Configuration
public class StartupConfig {

    @Bean
    public Jaxb2Marshaller marshaller() {
        Jaxb2Marshaller marshaller = new Jaxb2Marshaller();
        marshaller.setContextPath("com.icode.translate");
        return marshaller;
    }

    @Bean
    public TranslateClient translateClient(Jaxb2Marshaller marshaller) {
        TranslateClient client = new TranslateClient();
        client.setDefaultUri("http://fy.webxml.com.cn/webservices/EnglishChinese.asmx");
        client.setMarshaller(marshaller);
        client.setUnmarshaller(marshaller);
        return client;
    }
}
